repo: Ensure all stored files are readable
authorColin Walters <walters@verbum.org>
Sun, 26 Aug 2012 20:35:44 +0000 (16:35 -0400)
committerColin Walters <walters@verbum.org>
Sun, 26 Aug 2012 20:35:44 +0000 (16:35 -0400)
We really don't have a sane story for private files.  This is a
defensive step ensuring that with old versions of gnome-ostree,
components that mistakenly have un-world-readable files don't break
pulls.

src/libostree/ostree-repo.c

index b7d6976f4922febb3a34e69b61cfc19091c82367..c74c095a508cab3f545b7067621b6ef4c227ee53 100644 (file)
@@ -943,6 +943,11 @@ stage_object_internal (OstreeRepo         *self,
                */
               src_mode = g_file_info_get_attribute_uint32 (file_info, "unix::mode");
               target_mode = src_mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_IFMT);
+              /* However, do ensure that archive mode files are
+               * readable by all users.  This is important for serving
+               * files via HTTP.
+               */
+              target_mode |= (S_IRUSR | S_IRGRP | S_IROTH);
               
               if (chmod (ot_gfile_get_path_cached (raw_temp_file), target_mode) < 0)
                 {